package com.sh.设计模式.策略模式以及优化.原始策略模式实现;

/**
 * 上下文类
 * @author: sh
 */
public class DiscountContext {
    private DiscountStrategy strategy;

    public void setStrategy(DiscountStrategy strategy) {
        this.strategy = strategy;
    }

    public double getPrice(double price) {
        return strategy.applyDiscount(price);
    }
}
